package com.xiaoyun.bo;

import com.xiaoyun.annotation.PasswordMatch;
import com.xiaoyun.annotation.ValidPassword;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;

@ApiModel(value = "用户对象BO", description = "从客户端，由用户传入的数据封装在此entity中")
@Data
@PasswordMatch
public class UserBO {

    @ApiModelProperty(value = "用户名", name = "username", example = "xiaoyun", required = true)
    @NotBlank(message = "用户名不能为空")
    @Length(max = 12, message = "用户名长度不能超过12")
    private String username;

    @ApiModelProperty(value = "密码", name = "password", example = "123456", required = true)
    @ValidPassword
    @NotBlank(message = "密码不能为空")
    private String password;

    @ApiModelProperty(value = "确认密码", name = "confirmPassword", example = "123456", required = false)
    @NotBlank(message = "重输密码不能为空")
    private String confirmPassword;
}
